import fetch from 'common/src/utils/fetch';


/**
 * 查询列表
 */
export function minorCourseArrangeSearchPage(data, profile, showPre) {
    let url = '/api/arrangementservice/minorCourseArrange/page?1=1';
    if (profile) {
        url += '&profile';
    }
    if (showPre) {
        url += '&showpre';
    }
    return fetch({
        url,
        method: 'post',
        data: data
    });
}

/**
 * 根据Id查询教学班全量信息
 */
export function getClass(classId) {
    return fetch({
        url: '/api/arrangementservice/minorCourseArrange/class/' + classId,
        method: 'get'
    });
}

/**
 * 查询教学班详情
 */
export function getDetail(classId) {
    return fetch({
        url: '/api/arrangementservice/minorCourseArrange/getDetail?classId=' + classId,
        method: 'get'
    });
}

/**
 * 任务中更新某教学班
 * @param {任务ID} id
 * @param {新专业} data
 */
export function updateClassItem(id, data) {
    return fetch({
        url: '/api/arrangementservice/minorCourseArrange/' + id + '/class/update',
        method: 'post',
        data
    });
}

/**
 * 删除
 */
export function delete_(idList, ignoreElection) {
    if (ignoreElection) {
        return fetch({
            url: '/api/arrangementservice/minorCourseArrange?ignoreElection=true',
            method: 'delete',
            data: idList
        });
    } else {
        return fetch({
            url: '/api/arrangementservice/minorCourseArrange/delete',
            method: 'delete',
            data: idList
        });
    }
}

/**
 * 修改
 */
export function update(template) {
    return fetch({
        url: '/api/arrangementservice/minorCourseArrange/update',
        method: 'post',
        data: template
    });
}

/**
 * 新增
 */
export function add(template) {
    return fetch({
        url: '/api/arrangementservice/minorCourseArrange/add',
        method: 'put',
        data: template
    });
}

/**
 * 排课冲突检查
 * @param {*} data
 */
export function checkConflict(data) {
    return fetch({
        url: '/api/arrangementservice/minorCourseArrange/checkConflict',
        method: 'put',
        data: data
    });
}

export function getReportStatus(key) {
    return fetch({
        url: '/api/arrangementservice/assistData/workload/result/' + key,
        method: 'get'
    });
}

export function getMinorCourseLabelList(data) {
    return fetch({
        url: '/api/arrangementservice/MinorClassManagement/getMinorCourseLabelList',
        method: 'post',
        data: data
    });
}